﻿using Styx;
using Styx.CommonBot;

using WuzzCollection.Helpers;

namespace WuzzCollection.Classes
{
    internal partial class Hunter : AbstractClass
    {
        public void BeastmasterRotation()
        {
            if (!(Me.Auras.ContainsKey("Aspect of the Hawk") || Me.Auras.ContainsKey("Aspect of the Iron Hawk")))
            {
                if (SpellManager.Spells.ContainsKey("Aspect of the Iron Hawk"))
                {
                    if (Spell.CastBuff("Aspect of the Iron Hawk"))
                        return;
                }
                else
                {
                    if (Spell.CastBuff("Aspect of the Hawk"))
                        return;
                }
            }

            if (Me.Pet.HasAura("Frenzy") && Me.Pet.Auras["Frenzy"].StackCount == 5)
            {
                if (Spell.CastBuff("Focus Fire"))
                    return;
            }

            if (!Unit.HasMyAura(Me.CurrentTarget, "Serpent Sting"))
            {
                if (Spell.CastSpell("Serpent Sting"))
                    return;
            }

            if (BotSettings.BotCooldowns && Spell.CastBuff("Blood Fury"))
                return;

            if (Me.CurrentFocus <= 65)
            {
                if (Spell.CastBuff("Fervor"))
                    return;
            }

            if (BotSettings.BotCooldowns && Me.Pet.IsAlive && !Me.HasAura("The Beast Within") && Me.CurrentFocus > 60)
            {
                if (Spell.CastBuff("Bestial Wrath"))
                    return;
            }

            if (BotSettings.BotCooldowns && !Unit.HasMyAura(Me, "Rapid Fire"))
            {
                if (Spell.CastBuff("Rapid Fire"))
                    return;
            }

            if (Spell.CastSpell("Kill Shot"))
                return;

            if (Me.Pet.IsAlive)
            {
                if (Spell.CastSpell("Kill Command"))
                    return;
            }

            if (Spell.CastSpell("Glaive Toss"))
                return;

            if (Me.Pet.IsAlive)
            {
                if (Spell.CastSpell("Blink Strike"))
                    return;
            }

            if (BotSettings.BotCooldowns && Spell.HasSpell("Rapid Fire") && SpellManager.Spells["Rapid Fire"].Cooldown)
            {
                if (Spell.CastSpecial("Readiness"))
                    return;
            }

            //if (Helpers.Unit.HasMyAura(Me.CurrentTarget, "Serpent Sting") && Me.CurrentTarget.Auras["Serpent Sting"].TimeLeft.Seconds <= 6)
            //{
            //    CastSpell("Cobra Shot");
            //}

            if (Me.CurrentFocus > 60)
            {
                if (Spell.CastSpell("Arcane Shot"))
                    return;
            }

            if (Spell.HasSpell("Cobra Shot"))
            {
                if (Spell.CastSpell("Cobra Shot"))
                    return;
            }
            else
            {
                if (Spell.CastSpell("Steady Shot"))
                    return;
            }

        }
    }
}